package com.yueya.im.business.controller;

import com.yueya.auth.utils.UserInfoUtil;
import com.yueya.common.base.BaseController;
import com.yueya.common.web.RestResult;
import com.yueya.im.dao.tables.pojos.GroupDO;
import com.yueya.im.service.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("${auth.adminPath}/group/")
public class GroupController extends BaseController {
    @Autowired
    private GroupService groupService;

    @RequestMapping("list")
    public RestResult list(){
        String userId = UserInfoUtil.getPrincipal().getAccount().getId();
        List<GroupDO> list = groupService.findGroups(userId);
        return RestResult.OkWithData(list);
    }
}
